package 开始的剑指offer8月.搜索与回溯算法;
// https://leetcode-cn.com/problems/dui-cheng-de-er-cha-shu-lcof/
public class 剑指Offer28对称的二叉树0819 {
    class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;
        TreeNode(int x) { val = x; }
    }

    class Solution {
        public boolean isSymmetric(TreeNode root) {
            return root == null ? true : recur(root.left, root.right);
        }
        boolean recur(TreeNode L, TreeNode R) {
            if(L == null && R == null) return true;
            if(L == null || R == null || L.val != R.val) return false;
            return recur(L.left, R.right) && recur(L.right, R.left);
        }
    }
}



